import axios from '@/utils/axios'

export const getArticle = (id: string): Promise<ApiResult<LiteratureArticlePO>> => {
  return axios.get(`literature/article/${id}`)
}

export const getArticlePage = (
  pagination: Pagination,
  params: LiteratureArticlePO
): Promise<ApiResult<Page<LiteratureArticleVO>>> => {
  return axios.get(`literature/article/page/${pagination.page}/${pagination.pageSize}`, {
    params
  })
}

export const postOrPutArticle = (data: LiteratureArticlePO): Promise<ApiResult<null>> => {
  return axios.post(`literature/article`, data)
}

export const deleteArticle = (id: string): Promise<ApiResult<null>> => {
  return axios.delete(`literature/article/${id}`)
}
